package com.zhejiangzhengyuan.municipal_sewage.controller;

import com.zhejiangzhengyuan.municipal_common.entity.vo.DeviceVo;
import com.zhejiangzhengyuan.municipal_common.response.ResponseVo;
import com.zhejiangzhengyuan.municipal_common.service.DeviceService;
import com.zhejiangzhengyuan.municipal_common.utils.ConstantUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lin_ju
 * @create on 2019/12/14
 */
@RestController
@RequestMapping("/sewage/timeMonitoring")
@Api(tags = "雨污混排实时监控")
public class SewageTimeMonitoringController {

  @Autowired private DeviceService deviceService;

  private String deviceType = ConstantUtil.DEVICE_TYPE.SEWAGE;

  @ApiOperation(value = "查询设备跟设施", response = DeviceVo.class)
  @GetMapping("/getByPage")
  public ResponseVo getDeviceAndFacility() {
    List<DeviceVo> deviceVos = deviceService.getDeviceAndFacility(deviceType);
    return deviceVos == null ? ResponseVo.SERVER_ERROR : ResponseVo.successWithData(deviceVos);
  }
}
